<#include "/common/layout_dl.html">
<@header>
</@header>
<@body>
<div class="row">
	<div class="col-md-12">
	<div class="nav-tabs-custom">
	     <ul class="nav nav-tabs">
	       <li class="active"><a href="#tab_1" data-toggle="tab">Add Directory</a></li>
	       <li><a href="#tab_2" data-toggle="tab">Add Menu</a></li>
	       <li><a href="#tab_3" data-toggle="tab">Add Function</a></li>
	     </ul>
	     <div class="tab-content">
	       <div class="tab-pane active" id="tab_1">
	        	 <div class="row">
	  	<div class="col-md-6">
		  <form role="form" class="layui-form layui-form-pane" method="post" action="/system/menu/doAddDir">
		     <div class="box-body">
		       <div class="form-group">
		         <label for="uname">Code</label>
		        	<input type="text" name="code" class="form-control" placeholder="Please input code,such as 05" lay-verify="required">
		       </div>
		       <div class="form-group">
		         <label for="uname">Directory Name</label>
		        	<input type="text" name="menuName" class="form-control" placeholder="Please input directory name"  lay-verify="required">
		       </div>
		       <div class="form-group">
		         <label for="uname">Sort</label>
		        	<input type="text" name="sort" class="form-control" placeholder="Please input sort" lay-verify="required|number">
		       </div>
		       <div class="form-group">
		         <label for="uname">Icon</label>
		        	<input type="text" name="icon" value="fa-folder" class="form-control" placeholder="Please input icon, such as fa-user" >
		       </div>
		       <div class="form-group">
			     <button type="submit" class="btn btn-success" lay-submit lay-filter="submit"><i class="fa fa-save"></i>  Submit</button>
			     <a  class="btn btn-default" href="javascript:parent.layer.closeAll('iframe');"><i class="fa fa-close"></i>  Cancel</a>
			   </div>
		     </div><!-- /.box-body -->
	 	</form>
		</div>
	</div>
	     </div><!-- /.tab-pane -->
	    <div class="tab-pane" id="tab_2">
	       <div class="row">
	<div class="col-md-6">
	<form role="form" class="layui-form layui-form-pane" method="post" action="/system/menu/doAddMenu">
	  <div class="box-body">
	       <div class="form-group">
	          <label>Parent Menu</label>
	          <select name="pid" class="form-control select2" style="width: 100%;" lay-verify="required" lay-ignore>
	      <#list list as m>
	      <option value="${(m.id)!}">${(m.code)!}-${(m.menuName)!}</option>
	      </#list>
	    </select>
	  </div><!-- /.form-group -->
	  <div class="form-group">
	     <label for="uname">Code</label>
	    	<input type="text" name="code" class="form-control" 
	    	placeholder="Please input Code, such as 0501" data-rule="required;number" lay-verify="required">
	   </div>
	   <div class="form-group">
	     <label for="uname">MenuName</label>
	    	<input type="text" name="menuName" class="form-control" placeholder="Please input MenuName" lay-verify="required">
	   </div>
	   <div class="form-group">
	     <label for="uname">MenuURL</label>
	    	<input type="text" name="url" class="form-control" placeholder="Please input MenuURL"  lay-verify="required">
	   </div>
	   <div class="form-group">
	     <label for="uname">Sort</label>
	    	<input type="text" name="sort" class="form-control" placeholder="Please input sort"  lay-verify="required|number">
	   </div>  
	   <div class="form-group">
	     <label for="uname">Icon</label>
	    	<input type="text" name="icon" value="fa-file" class="form-control" placeholder="Please input icon, such as fa-user" >
	   </div>
	    <div class="form-group">
	     <button type="submit" class="btn btn-success" lay-submit lay-filter="submit"><i class="fa fa-save"></i>  Submit</button>
	     <a  class="btn btn-default" href="javascript:parent.layer.closeAll('iframe');"><i class="fa fa-close"></i>  Cancel</a>
	   </div>
	</div><!-- /.box-body -->
	 </form>
		</div>
	</div>
	     </div><!-- /.tab-pane -->
	    
	     <div class="tab-pane" id="tab_3">
	     	 <div class="row">
	<div class="col-md-6">
	<form role="form" class="layui-form layui-form-pane" method="post" action="/system/menu/doAddAction">
	  <div class="box-body">
	    <div class="form-group">
	         <label>Select Directory/Menu</label>
	         <select id="dir" class="form-control select2" style="width: 100%;" lay-verify="required" lay-ignore>
	     <option value="" selected="selected">--Please select--</option>
	     <#list list as m>
	     <option value="${(m.id)!}">${(m.code)!}-${(m.menuName)!}</option>
	     </#list>
	   </select>
	   <select id="pid" name="pid" class="form-control select2" style="width: 100%;" lay-verify="required" lay-ignore>
	         <option value="" selected="selected">--Please select--</option>
	     </select>
		</div>
		<div class="form-group">
	       <label for="uname">Code</label>
	      	<input type="text" name="code" class="form-control" 
	      	placeholder="Please input code, such as 050101"  lay-verify="required">
	     </div>
	     <div class="form-group">
	       <label for="uname">Function Name</label>
	      	<input type="text" name="menuName" class="form-control" placeholder="Please input function name"  lay-verify="required">
	     </div>
	     <div class="form-group">
	       <label for="resource">Permission Resource</label>
	      	<input type="text" id="resource" name="resource" class="form-control" placeholder="Please input permission resource name"  lay-verify="required|check" check-url="/system/menu/checkMenuResource">
	     </div> 
	     <div class="form-group">
	       <label for="uname">Sort</label>
	      	<input type="text" name="sort" class="form-control" placeholder="Please input sort"  lay-verify="required|number">
	     </div>
	      <div class="form-group">
		     <button type="submit" class="btn btn-success" lay-submit lay-filter="submit"><i class="fa fa-save"></i>  Submit</button>
		     <a  class="btn btn-default" href="javascript:parent.layer.closeAll('iframe');"><i class="fa fa-close"></i>  Cancel</a>
		   </div>
	   </div><!-- /.box-body -->
	 </form>
		</div>
	</div>
	     </div><!-- /.tab-pane -->
	
	</div><!-- /.tab-pane -->
	</div><!-- /.tab-content -->
	</div><!-- nav-tabs-custom -->
	</div>
</@body>
<@footer>
<script>
$("#dir").on('change',function(){
	var pid = $(this).val();
	 $.post('/system/menu/json?_dc='+new Date().getTime(),{pid:pid},function(response){
		if(response.code==200){
			$("#pid").empty();
			$("#pid").select2({
				data:response.data
			});
		}
	}); 
});
</script>
</@footer>